package com.topone.dataObject.Mapper;

import com.topone.dataObject.Bussiness;
import com.topone.dto.BussinessDTO;
import com.topone.dto.TcCouponDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * Created by Administrator on 2018/1/18,0018.
 */
public interface BussinessMapper {

//    @Select("select * from bussiness where bussiness_status=#{status}")
//    @Results({
//      @Result(column = "bussiness_id",property = "bussinessId"),
//      @Result(column = "bussiness_code",property = "bussinessCode"),
//      @Result(column = "bussiness_name",property = "bussinessName"),
//      @Result(column = "bussiness_user_name",property = "bussinessUserName"),
//      @Result(column = "bussiness_product",property = "bussinessProduct"),
//      @Result(column = "bussiness_category",property = "bussinessCategory"),
//      @Result(column = "bussiness_rank",property = "bussinessRank"),
//      @Result(column = "bussiness_address",property = "bussinessAddress"),
//      @Result(column = "bussiness_phone",property = "bussinessPhone"),
//      @Result(column = "bussiness_position",property = "bussinessPosition"),
//      @Result(column = "bussiness_introduce",property = "bussinessIntroduce"),
//    })
    List<BussinessDTO> allBussiness(@Param("status") Integer status);

    @Select("select * from bussiness where bussiness_name=#{bussinessName} and bussiness_status=#{status}")
    Bussiness bussiness(@Param("bussinessName") String bussinessName, @Param("status") Integer status);

    @Select("select * from bussiness where bussiness_password=#{bussinessPassword} and bussiness_phone=#{bussinessPhone}")
    @Results({
            @Result(column = "bussiness_id",property = "bussinessId")
    })
    BussinessDTO findBussinessId(@Param("bussinessPassword") String bussinessPassword,@Param("bussinessPhone") String bussinessPhone);

    //根据商家名称模糊查询
   List<BussinessDTO> findBussinessByBussinessNameLike(String bussinessName);

   BussinessDTO findBussinessItemById(String bussinessId);
}
